"""

"""
# from a2022.unittest.maths import *
import time
import unittest
from parameterized import parameterized
import json
from HTMLTestRunner import HTMLTestRunner
def add(x, y):
    return x + y


with open('a.json', 'r') as f:
    data = json.loads(f.read())


class AddTest(unittest.TestCase):
    # 第一种参数化方式： @parameterized.expand装饰器
    # @parameterized.expand([(1, 1, 2),
    #                        (2, 2, 4),
    #                        ('he', 'llo', "hello")])
    # 第二种
    # data = [(1,1,2),(2,2,4),('he','llo','hello')]
    # @parameterized.expand(data)
    # 第三种
    # def build_data(self):
    #     return [(1, 1, 2), (2, 2, 4), ('h', 'e', 'he')]

    @parameterized.expand(data)
    def test_add_1(self, x, y, z):
        print("{}+{}={}".format(x, y, z))
        result = add(x, y)  # 实际结果
        # 断言
        self.assertEqual(result, z)


if __name__ == '__main__':
    unittest.main()
